#pragma once

namespace krryn{
namespace scene{
	enum lock_type{
		none		= 0, // not locked
		read		= 0x01,
		write		= 0x02,
		read_write	= read | write
	};

	class hardware_buffer{
	public:
		hardware_buffer();

		virtual void lock(lock_type a_Type);
		virtual void unlock();
		virtual lock_type locked();
	private:
		lock_type m_Locked;
	};

	/// RAII helper
	class hardware_locker{
	public:
		hardware_locker(hardware_buffer &a_Buffer, lock_type a_Type) 
			: m_Buffer(a_Buffer){ m_Buffer.lock(a_Type); }

		~hardware_locker(){m_Buffer.unlock();}
	private:
		hardware_buffer &m_Buffer;
	};
}
}
